From 17795caf52a78c773e7ba5b914bb0579766f146a Mon Sep 17 00:00:00 2001 From: Keir Fraser Date: Tue, 9 Mar 2010 17:58:11 +0000 Subject: [PATCH] Intel VT-D: Don't turn x2APIC if there is a missing DRHD entry for the IOAPIC. Follow the Linux kernel lead in which the x2APIC is only turned on only if there is an DRHD entry for all IOAPICs in the system. If we don't do this we might enable x2APIC and see various devices not covered by the IOAPIC mentioned in DRHD, not receive any interrupts. From: Konrad Rzeszutek Wilk Signed-off-by: Keir Fraser --- xen/drivers/passthrough/vtd/intremap.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/xen/drivers/passthrough/vtd/intremap.c b/xen/drivers/passthrough/vtd/intremap.c index 9459a81736..0b3d95827b 100644 --- a/xen/drivers/passthrough/vtd/intremap.c +++ b/xen/drivers/passthrough/vtd/intremap.c @@ -127,10 +127,16 @@ static void set_ioapic_source_id(int apic_id, struct iremap_entry *ire) int iommu_supports_eim(void) { struct acpi_drhd_unit *drhd; + int apic; if ( !iommu_enabled || !iommu_qinval || !iommu_intremap ) return 0; + /* We MUST have a DRHD unit for each IOAPIC. */ + for ( apic = 0; apic < nr_ioapics; apic++ ) + if ( !ioapic_to_iommu(IO_APIC_ID(apic)) ) + return 0; + if ( list_empty(&acpi_drhd_units) ) return 0; -- 2.30.2